import {useState,useCallback} from 'react'

let set  = new Set();

export default ()=>{
    
    let [name,setName] = useState("");
    let [num,setNum] = useState(0);
    let [otherNum,setOtherNum] = useState(0);

    let handleChange=(e)=>{
      console.log(e.target.value);
     setName(e.target.value)
    } 

    let handleClick=()=>{
        setNum(num+1)
    }

    let call = useCallback(
        () => {handleChange()},
        [num],
    )
    set.add(call);
    console.log(set);
    console.log("长度：",set.size);
   
    return(
        <div>
            <input value={name} onChange={handleChange} ></input>
            <button onClick={handleClick}>(num):{num}</button>
            &nbsp; &nbsp; &nbsp;
             <button onClick={()=>{
                  setOtherNum(otherNum+1)
            }}>(otherNum):{otherNum}</button>
        </div>
    )
}